package com.service.single.example.pattern.factory;

public class VehicleFactory {

    public Vehicle getVehicle(String c) {
        if (c.equals(Bicycle.class.getSimpleName())) {
            return new Bicycle();
        }
        if (c.equals(Car.class.getSimpleName())) {
            return new Car();
        }
        return null;
    }

    public static void main(String[] args) {
        VehicleFactory factory = new VehicleFactory();
        String type = factory.getVehicle("Car").type();
        System.out.println(type);
    }
}
